feat: add tests for admin transfer consistency and oracle delete_result TTL#721
Merged
Conversation
…lt TTL - Add test_transfer_admin_and_two_step_transfer_are_mutually_consistent: verifies that using transfer_admin (one-step) followed by propose_admin + accept_admin (two-step) produces consistent final admin state — new admin accepted, previous admin rejected. - Add test_instance_ttl_extended_on_delete_result: confirms delete_result calls extend_instance_ttl consistently with every other oracle method, restoring instance TTL to MATCH_TTL_LEDGERS. Fix pre-existing bugs unblocked by restoring compilation: - create_match omitted extend_ttl for DataKey::GameId, causing expire_match to panic with Storage::InternalError in tests that advanced the ledger past the minimum TTL. - Reconstructed two interleaved test functions that had been corrupted by a bad insertion, and corrected a wrong ledger offset (100 → 500) in the expire path of test_cancel_and_expire_terminal_state_and_ledger_metadata. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…-oracle-delete-result-ttl
|
@Markodiba6399 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
test_transfer_admin_and_two_step_transfer_are_mutually_consistent(escrow): chains the one-steptransfer_adminpath with the two-steppropose_admin+accept_adminpath and asserts the final admin state is identical — new admin accepted, previous admin rejected with explicit auth mocks.test_instance_ttl_extended_on_delete_result(oracle): advances the ledger pastMATCH_TTL_LEDGERS / 2so the TTL drops below the extension threshold, then callsdelete_resultand asserts the instance TTL is restored toMATCH_TTL_LEDGERS, confirming consistency with every other oracle method.Bug fixes (unblocked by restoring compilation)
create_matchmissingextend_ttlforDataKey::GameId— the key was stored in persistent storage without a TTL extension, so it archived after the default minimum TTL. Any test that advanced the ledger (e.g. expire-match tests) would panic withError(Storage, InternalError)whenexpire_matchtried to remove the archived key. Fixed by addingextend_ttl(MATCH_TTL_LEDGERS, MATCH_TTL_LEDGERS)for the GameId entry increate_match.escrow/src/tests.rs— a previous edit had interleavedtest_instance_ttl_refreshed_after_create_matchinsidetest_lowering_timeout_after_match_creation_affects_expiry_immediately, splitting acreate_matchcall and leaving orphaned code. Both tests are restored to standalone, correct implementations.test_cancel_and_expire_terminal_state_and_ledger_metadata— the secondset_sequence_numberused100 + DEFAULT_MATCH_TIMEOUT_LEDGERSinstead of500 + DEFAULT_MATCH_TIMEOUT_LEDGERS, making elapsed < timeout soexpire_matchwould never succeed.Test plan
cargo test -p escrow— 102 passed, 0 failedcargo test -p oracle— 37 passed, 0 failedokcloses #625
closes #626